package com.jtech.dribbble.view.activity.base;

import android.os.Bundle;
import android.os.PersistableBundle;
import android.support.v7.app.AppCompatActivity;

import com.jtech.dribbble.net.call.JCall;
import com.jtech.dribbble.util.RequestManager;

import java.util.ArrayList;
import java.util.List;

import butterknife.ButterKnife;

/**
 * activity基类
 * Created by wuxubaiyang on 16/4/16.
 */
public class BaseActivity extends AppCompatActivity {

    private RequestManager requestManager;

    @Override
    public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
        super.onCreate(savedInstanceState, persistentState);
        //绑定注解
        ButterKnife.bind(getActivity());
        //实例化请求管理对象
        requestManager = new RequestManager();
    }

    /**
     * 获取activity对象
     *
     * @return
     */
    public BaseActivity getActivity() {
        return this;
    }

    /**
     * 获取请求管理对象
     *
     * @return
     */
    public RequestManager getRequestManager() {
        return requestManager;
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        //取消全部请求
        requestManager.clearAllCall();
    }
}